package demo2;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 何华树
 * Date: 2024-09-10
 * Time: 15:09
 */
class Myval {
    public int val;
}
public class Change {
    public static void Swap(Myval m1,Myval m2) {
        int tmp = m1.val;
        m1.val = m2.val;
        m2.val = tmp;
    }
    public static void main1(String[] args) {
        Myval myval1 = new Myval();
        Myval myval2 = new Myval();
        myval1.val = 10;
        myval2.val = 20;
        System.out.println("交换之前："+" "+myval1.val+" "+myval2.val);
        Swap(myval1,myval2);
        System.out.println("交换之后："+" "+myval1.val+" "+myval2.val);
    }
}
